/*
 * CAnt.h
 *
 *  Created on: 14 Oct 2012
 *      Author: Mario Kleinsasser
 *		Time:	17:23:45
 */

#ifndef CANT_H_
#define CANT_H_

#include "CItem.h"
#include "CEnvironment.h"
#include "CAnthill.h"

using namespace std;

class CAnt: public CItem {

private:
	int M;
	int N;

	int lastM;
	int lastN;

	void calculateMove(CEnvironment &environment);

	/*
	 * turn count needed
	 * without this, it could be that we move more than one time per round!
	 * not good
	 */
	int turncnt;

	/*
	 * Recognize if we are on the way home
	 */
	int foundFood;

	/*
	 * the food we get from anthill is our lifetime
	 * after 20 moves the ant will die
	 */
	int foodlivetime;

	/*
	 * Check if area has food
	 */
	bool checkForAreaType(CArea *area);

	/*
	 * born in anthill
	 */
	CAnthill *OriginAnthill;

	/*
	 * Type of class
	 * Usefull to avoid rtti. This allows me to dirctly cast the right type without vtable
	 */
	string getClassType() const {
		return classType;
	}

public:
	CAnt();
	virtual ~CAnt();

	int act();

	void print();

	CAnthill* getOriginAnthill() const {
		return OriginAnthill;
	}

	void setOriginAnthill(CAnthill* originAnthill) {
		OriginAnthill = originAnthill;
	}

	int getTurncnt() const {
		return turncnt;
	}

	void setTurncnt(int turncnt) {
		this->turncnt = turncnt;
	}

	int getM() const {
		return M;
	}

	void setM(int m) {
		M = m;
	}

	int getN() const {
		return N;
	}

	void setN(int n) {
		N = n;
	}
};

#endif /* CANT_H_ */
